package brc.syntacticTree;

import java.io.IOException;
import java.io.Writer;

public class ConstantNumberNode implements TypedTreeNode {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1743313101397629768L;
	private int number;
	
	public ConstantNumberNode(String image) {
		this(Integer.parseInt(image));
	}
	public ConstantNumberNode(int number) {
		this.number = number;
	}	

	public int getNumber() {
		return this.number;
	}

	@Override
	public void writeAssembly(Writer writer) throws IOException {
		writer.write("ldc " + this.number + "\r\n");
	}

	@Override
	public void semanticCheck() throws SemanticException {
		// TODO Auto-generated method stub

	}

	@Override
	public int getType() {
		return TypedTreeNode.TIPO_NUMERO;
	}
}
